//导入自己的mongoose
const mongoose = require("./connect")

//用户表的schema
const userSchema = new mongoose.Schema({
    username: {
        require: true,
        type: String
    },
    password: {
        require: true,
        type: String
    },
    email: {
        require: true,
        type: String
    },
    tel: {
        require: true,
        type: Number
    },
    enable: {
        type: Boolean,
        default: false
    },
    createdAt: {
        type: Date,
        default: +new Date()
    },
    updatedAt: {
        type: Date,
        default: +new Date()
    }
})

const userModel = mongoose.model('user', userSchema, 'user')

module.exports = userModel